﻿using System.Reflection;

namespace RemoteTestRunner.BusinessLogic.ViewModels
{
    public class AboutViewModel
    {
        #region Properties

        /// <summary>
        /// Gets the version of the currently running application.
        /// </summary>
        public string Version
        {
            get { return string.Format("Version: {0}", Assembly.GetEntryAssembly().GetName().Version); }
        }

        /// <summary>
        /// Gets the description of the entry assembly.
        /// </summary>
        public string Description
        {
            get
            {
                var attributes = Assembly.GetEntryAssembly().GetCustomAttributes(typeof(AssemblyDescriptionAttribute), false);

                return attributes.Length == 0 ? string.Empty : ((AssemblyDescriptionAttribute)attributes[0]).Description;
            }
        }

        /// <summary>
        /// Gets the copyright of the entry assembly.
        /// </summary>
        public string Copyright
        {
            get
            {
                var attributes = Assembly.GetEntryAssembly().GetCustomAttributes(typeof(AssemblyCopyrightAttribute), false);

                return attributes.Length == 0 ? string.Empty : ((AssemblyCopyrightAttribute)attributes[0]).Copyright;
            }
        }

        #endregion
    }
}
